package Easy;

import java.util.ArrayList;

class RecentCounter {
    private ArrayList<Integer> requests = new ArrayList<>();

    public RecentCounter() {
    }

    public int ping(int t) {
        requests.add(t);
        int count = 0;
        for (int i = requests.size() - 1; i >= 0; i--) {
            if (t - requests.get(i) <= 3000) count++;
            else break;
        }
        return count;
    }
}

/**
 * Your RecentCounter object will be instantiated and called as such:
 * RecentCounter obj = new RecentCounter();
 * int param_1 = obj.ping(t);
 */